<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of rbfjacob</title>
  <meta name="keywords" content="rbfjacob">
  <meta name="description" content="RBFJACOB Evaluate derivatives of RBF network outputs with respect to inputs.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../../menu.html">Home</a> &gt;  <a href="#">ReBEL-0.2.7</a> &gt; <a href="#">netlab</a> &gt; rbfjacob.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../../menu.html"><img alt="<" border="0" src="../../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="menu.html">Index for .\ReBEL-0.2.7\netlab&nbsp;<img alt=">" border="0" src="../../right.png"></a></td></tr></table>-->

<h1>rbfjacob
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>RBFJACOB Evaluate derivatives of RBF network outputs with respect to inputs.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function jac = rbfjacob(net, x) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment">RBFJACOB Evaluate derivatives of RBF network outputs with respect to inputs.

    Description
    G = RBFJACOB(NET, X) takes a network data structure NET and a matrix
    of input vectors X and returns a three-index matrix G whose I, J, K
    element contains the derivative of network output K with respect to
    input parameter J for input pattern I.

    See also
    <a href="rbf.html" class="code" title="function net = rbf(nin, nhidden, nout, rbfunc, outfunc, prior, beta)">RBF</a>, <a href="rbfgrad.html" class="code" title="function [g, gdata, gprior] = rbfgrad(net, x, t)">RBFGRAD</a>, <a href="rbfbkp.html" class="code" title="function g = rbfbkp(net, x, z, n2, deltas)">RBFBKP</a></pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="consist.html" class="code" title="function errstring = consist(model, type, inputs, outputs)">consist</a>	CONSIST Check that arguments are consistent.</li><li><a href="rbffwd.html" class="code" title="function [a, z, n2] = rbffwd(net, x)">rbffwd</a>	RBFFWD	Forward propagation through RBF network with linear outputs.</li></ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="gtmmag.html" class="code" title="function mags = gtmmag(net, latent_data)">gtmmag</a>	GTMMAG	Magnification factors for a GTM</li></ul>
<!-- crossreference -->


<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function jac = rbfjacob(net, x)</a>
0002 <span class="comment">%RBFJACOB Evaluate derivatives of RBF network outputs with respect to inputs.</span>
0003 <span class="comment">%</span>
0004 <span class="comment">%    Description</span>
0005 <span class="comment">%    G = RBFJACOB(NET, X) takes a network data structure NET and a matrix</span>
0006 <span class="comment">%    of input vectors X and returns a three-index matrix G whose I, J, K</span>
0007 <span class="comment">%    element contains the derivative of network output K with respect to</span>
0008 <span class="comment">%    input parameter J for input pattern I.</span>
0009 <span class="comment">%</span>
0010 <span class="comment">%    See also</span>
0011 <span class="comment">%    RBF, RBFGRAD, RBFBKP</span>
0012 <span class="comment">%</span>
0013 
0014 <span class="comment">%    Copyright (c) Ian T Nabney (1996-2001)</span>
0015 
0016 <span class="comment">% Check arguments for consistency</span>
0017 errstring = <a href="consist.html" class="code" title="function errstring = consist(model, type, inputs, outputs)">consist</a>(net, <span class="string">'rbf'</span>, x);
0018 <span class="keyword">if</span> ~isempty(errstring);
0019   error(errstring);
0020 <span class="keyword">end</span>
0021 
0022 <span class="keyword">if</span> ~strcmp(net.outfn, <span class="string">'linear'</span>)
0023   error(<span class="string">'Function only implemented for linear outputs'</span>)
0024 <span class="keyword">end</span>
0025 
0026 [y, z, n2] = <a href="rbffwd.html" class="code" title="function [a, z, n2] = rbffwd(net, x)">rbffwd</a>(net, x);
0027 
0028 ndata = size(x, 1);
0029 jac = zeros(ndata, net.nin, net.nout);
0030 Psi = zeros(net.nin, net.nhidden);
0031 <span class="comment">% Calculate derivative of activations wrt n2</span>
0032 <span class="keyword">switch</span> net.actfn
0033 <span class="keyword">case</span> <span class="string">'gaussian'</span>
0034   dz = -z./(ones(ndata, 1)*net.wi);
0035 <span class="keyword">case</span> <span class="string">'tps'</span>
0036   dz = 2*(1 + log(n2+(n2==0)));
0037 <span class="keyword">case</span> <span class="string">'r4logr'</span>
0038   dz = 2*(n2.*(1+2.*log(n2+(n2==0))));
0039 <span class="keyword">otherwise</span>
0040    error([<span class="string">'Unknown activation function '</span>, net.actfn]);
0041 <span class="keyword">end</span>
0042 
0043 <span class="comment">% Ignore biases as they cannot affect Jacobian</span>
0044 <span class="keyword">for</span> n = 1:ndata
0045   Psi = (ones(net.nin, 1)*dz(n, :)).* <span class="keyword">...</span>
0046     (x(n, :)'*ones(1, net.nhidden) - net.c');
0047   <span class="comment">% Now compute the Jacobian</span>
0048   jac(n, :, :) =  Psi * net.w2;
0049 <span class="keyword">end</span></pre></div>
<hr><address>Generated on Tue 26-Sep-2006 10:36:21 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
</body>
</html>